from TwitterAPI import TwitterAPI

import os
import configparser
config = configparser.ConfigParser()
config.read('config/config.ini')

CONSUMER_KEY = os.environ.get('CONSUMER_KEY', config['TWITTER']['CONSUMER_KEY'])
CONSUMER_SECRET = os.environ.get('CONSUMER_SECRET', config['TWITTER']['CONSUMER_SECRET'])

ACCESS_TOKEN = os.environ.get('ACCESS_TOKEN', config['TWITTER']['ACCESS_TOKEN'])
ACCESS_TOKEN_SECRET = os.environ.get('ACCESS_TOKEN_SECRET', config['TWITTER']['ACCESS_TOKEN_SECRET'])

#The environment name for the beta is filled below. Will need changing in future		
ENVNAME = os.environ.get('ENVNAME', config['TWITTER']['ENVNAME'])
WEBHOOK_URL = os.environ.get('WEBHOOK_URL', config['TWITTER']['WEBHOOK_URL'])

twitterAPI = TwitterAPI(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET)

r = twitterAPI.request('account_activity/all/:%s/webhooks' % ENVNAME, {'url': WEBHOOK_URL})

print (r.status_code)
print (r.text)
